<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>后台管理</title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/js/artDialog/skins/blue.css">


<link href="__PUBLIC__/Admin/css/style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/css/dialog.reset.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/validform/style.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/ThinkBox/css/ThinkBox.css" media="all">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/bootstrap/css/font-awesome.min.css">
<link href="__PUBLIC__/Intesys/default/stylesheets/font-awesome.css" media="all" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/Admin/bootstrap/js/jquery.min.js"></script>
<script src="__PUBLIC__/Admin/bootstrap/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/Admin/js/artDialog/artDialog.source.js"></script>
<script src="__PUBLIC__/Admin/js/artDialog/plugins/iframeTools.js"></script>
<script src="__PUBLIC__/Admin/js/My97DatePicker/WdatePicker.js"></script>
<script src="__PUBLIC__/Js/validform/Validform.js"></script>
<script src="__PUBLIC__/Js/ThinkBox/jquery.ThinkBox.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/lang/zh-cn/zh-cn.js"></script>
</script>

<script src="__PUBLIC__/Admin/AdminEX/js/jquery.nicescroll.js"></script>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/wangEditor/css/wangEditor-mobile.min.css">
<script src="__PUBLIC__/Admin/wangEditor/lib/zepto.js"></script>
<!--<script src="__PUBLIC__/Admin/wangEditor/lib/zepto.touch.js"></script>-->
<script src="__PUBLIC__/Admin/wangEditor/wangEditor-mobile.js"></script>

</head>
<script>


//显示图片选择框
var mydialog = art.dialog;




//风格选择	 
function showPagesBox(curElement){
	art.dialog.data('curElement',curElement);
	art.dialog.open('{:U('Pages/pagesBox')}', {width: 800, height: 500,lock:true,title:'选择显示风格', ok:function(){
			var d = this.iframe.contentWindow.document;
			var img_url = $(d).find('#Imgselected').attr('img_url');
			$(curElement).parent().find("input[type='hidden']").eq(0).val(img_url);
			$(curElement).val('__PUBLIC__'+img_url);
			$(curElement).focus();
			$(curElement).blur();
			curElement.src = '__PUBLIC__'+img_url;
	}});
}


    function error(msg){
		var d = artDialog({
			title: '操作错误',
			content: msg,
			cancel: false,
			ok: function () {
				
				}
		});
		d.show();
	}
	function success(msg){
		var d = artDialog({
			title: '操作成功',
			content: msg,
			cancel: false,
			ok: function () {
				
				}
		});
		d.show();
	}
	
	function sall(){
		
		$('.sall').each(function(index, element) {
            if($(this).prop('checked')== true){
				$(this).prop('checked',false);
				$(this).parent('.checked').removeClass('checked');
			}else{

				$(this).prop('checked',true);
				$(this).parent().addClass('checked');
			}
        });
  
	}
	
	function rall(){
		$('.sall').prop('checked',false);
		$('.sall').parent().removeClass('checked')
	}
	
	
	//移动内容 到分类
	function movenews(e){
		var ids=new Array();
		$('.sall').each(function(index, element) {
            if($(this).prop('checked')== true){
				ids.push($(this).val());
			}
        });
		if(ids.length>0){
			if(confirm('您确定要移动选中记录吗？')){
			    window.location.href="{:U('move')}?id="+ids.toString()+"&category_id="+e.value;
			}else{
				return false;
			}
		}else{
			error('请选择要移动的记录');
		}
	}
	function delall(){
		var ids=new Array();
		$('.sall').each(function(index, element) {
            if($(this).prop('checked')== true){
				ids.push($(this).val());
			}
        });
		if(ids.length>0){
			if(confirm('您确定要删除选中记录吗？')){
			    window.location.href="{:U('delete')}?id="+ids.toString();
			}else{
				return false;
			}
		}else{
			error('请选择要删除的记录');
		}
	}
	
	
	function ajaxText(e){
		var tablename = $(e).parent().attr('tablename');
		var field = $(e).parent().attr('field');
		var id = $(e).parent().attr('id');
		var val = $(e).val();
		$.post('{:U('ajaxText')}',{tablename:tablename,field:field,id:id,val:val},function(data){
			if(data.status == 1){
			    $(e).parent().text(data.data);
			}else{
				alert(data.info);
			}
		},'json');
	}
	
	$(document).ready(function(e) {
		$('.topmenulist li').each(function(index, element) {
            if($(this).find('ul li').length > 0){
				$(this).removeClass('hidden');
			}
        });
		
		
		
		$('.navbar-toggle').click(function(e) {
            if($('body.nav-open').length > 0){
				$('body').removeClass('nav-open');
				$('.navbar-brand').show();
				$('.navbar-toggle').css('float','right');
				$('#nav-fixed-layout').hide();
			}else{
				$('body').addClass('nav-open');
				$('.navbar-brand').show();
				$('.navbar-toggle').css('float','left');
				$('#nav-fixed-layout').show();
			}
        });
		$('#nav-fixed-layout').click(function(e) {
            $('body').removeClass('nav-open');
			$('.navbar-brand').show();
			$('.navbar-toggle').css('float','right');
			$('#nav-fixed-layout').hide();
        });
		
		
		//点击ajax修改文字
		$('span.ajaxText').each(function(index, element) {
			$(this).click(function(e) {
				if($(this).find('input').length == 0){
			    var text = $(this).text();
                var input = $('<input type="text" onBlur="ajaxText(this);" style="width:100%; max-width:100%;" class="form-control" value="">');
				$(this).empty();
				input.appendTo($(this));
				input.keypress(function(e) {
                    if(e.keyCode == 13){
						ajaxText(input);
					}
                });
				input.focus().val(text);
				}
            });
            
        });
		
		//清除缓存
		$('.clearCache').click(function(e) {
            $.post('{:U('clearCache')}',{},function(data){
				if(data.status == 1){
					$.ThinkBox.success(data.info,{'delayClose':100});
				}else{
					$.ThinkBox.error(data.info,{'delayClose':200});
				}
			},'json');
        });
		//预览前台
		$('#openIndex').click(function(e) {
            $.post('{:U('clearCache')}',{},function(data){
				if(data.status == 1){
					
					//window.open("{:U('/',array(),true,false,true,__SITEID__)}");
					$('#openIndexbtn').submit();
					//$.ThinkBox.success(data.info,{'delayClose':100});
				}else{
					$.ThinkBox.error(data.info,{'delayClose':200});
				}
			},'json');
        });
		//表单验证
		$(".checkoutform:eq(0)").Validform({
			ajaxPost:true,
			tiptype:function(data,s){
				if(s.type == 1){
					$.ThinkBox.success(data,{'delayClose':0, 'close': '关闭'});
				}
			},
			datatype:{
				"text":function(gets,obj,curform,regxp){
					return true;
				},"image":function(gets,obj,curform,regxp){
					return true;
				}
			},
			callback:function(data){
				//检测登录 
				
				if(data.status == 0){
					$.ThinkBox.error(data.info,{'delayClose':200});
					//$.ThinkBox('hide');
					$('.ThinkBox-close').trigger('click');
				}else{
					
					$.ThinkBox.success(data.info,{'delayClose':200}); 
					    
							try{
							    window.parent.submitSuccess(data.status,data.info,data.data);
								mydialog.close();
							}catch (e){
								window.parent.location.href=data.url;
							}
						
				}
			}
	    });
 		//头部菜单 
		$('.topmenu').each(function(index, element) {
            $(this).mouseenter(function(e) {
				$(this).addClass('cur');
                $(this).find('ul').removeClass('h');
            });
			$(this).mouseleave(function(e) {
				$(this).removeClass('cur');
                $(this).find('ul').addClass('h');
            });
        });
		
		
        /*$('.data_list').each(function(index, element) {
            $(this).mouseenter(function(e) {
                $(this).css({'background':'#D7F7F9'});
            });
			$(this).mouseleave(function(e) {
                $(this).css({'background':'#fff'});
            });*/
			//$(this).find("input[type='checkbox']").click();
			/*$(this).find("input[type='checkbox']").click(function(){
					if($(this).attr('checked')=='checked'){
					
					    $(this).attr('checked',false);
				    }else{
					    $(this).attr('checked',true);
				    }
				});
			$(this).find("input[type='checkbox']").parent().click(function(e) {
				
                if($(this).find("input[type='checkbox']").attr('checked')=='checked'){
					
					$(this).find("input[type='checkbox']").attr('checked',false);
				}else{
					$(this).find("input[type='checkbox']").attr('checked',true);
				}
            });
        });*/

		
		//异步更新int字段
		$('.status_btn').each(function(index, element) {
            $(this).click(function(e) {
				$.ajax({
					url:"<?php echo U('ajaxUpdate');?>",
					type:"post",
					data:"data="+$(this).attr('field'),
					dataType:"json",
					success: function(data){
						if(data.status==1){
							$('.status_btn').eq(index).removeClass("status1");
							$('.status_btn').eq(index).removeClass("status0");
							$('.status_btn').eq(index).addClass("status"+data.data);
						}else{
							error(data.info);
						}
					}
				});
            });
        });
    });
	
	//更新排序
	//key主键/field更新字段名/el当前按钮对象/url服务端地址
	function update_sort(key,field,el,url){
		var data=new Array();
		$("input[name='"+key+"']").each(function(index, element) {
            data.push($(this).val()+'_'+$(this).parent().parent().find("input[name='"+field+"']").val());
        });
		$.post(url,{'sort':data.toString(),'field':field},function(data){
			if(data=='OK'){
				if(el==''){
					success('更新成功');
				}
			}else{
				error('更新失败');
			}
		});
	}

	function total_amount(key){
		var data='';
		$("input[name='"+key+"']:checked").each(function(index, element){
            data=$(this).val()+'_'+data;
        });
        if(data != '' ){
        	art.dialog.open("__URL__/totalamount/id/"+data, {width: 800, height: 500,lock:true,title:'总计金额'});
        }
	}
	
	//更新排序,点击移动更新
	function update_sortClick(key,type,el,field,sendurl){
		var data=new Array();
		if(type=='up'){
			$(el).parent().parent().after($(el).parent().parent().prev());
		}else{
			$(el).parent().parent().next().after($(el).parent().parent());
		}
		$("input[name='"+key+"']").each(function(index, element) {
			$(this).parent().parent().find("input[name='"+field+"']").val(index+1);
            data.push($(this).val()+'_'+$(this).parent().parent().find("input[name='"+field+"']").val());
        });
		
		//列新排序
		update_sort(key,field,el,sendurl);
	}
	
</script>
<body>
<if condition="$_SESSION['anonymous']">
<div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0;">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>温馨提示：</strong> 您使用的是体验版，请<a href="{:U('/',array(),true,false,true,$_SESSION['memberInfo']['site_id'])}" style="color:#f00;">点击这里</a>购买正版！谢谢！
</div>
</if>
<div id="nav-fixed-layout" style="position:fixed; height:10000px; width:100%; z-index:200; display:none; background:rgba(0,0,0,0.6)"></div>
<div class="container header">
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand logo" style="padding:0px; width:50px;" href="{:U('Index/index')}">
                    
                </a>
                <a href="##" onClick="art.dialog.open('{:U('Index/info')}', {width: 500, height: 350,lock:true,title:'修改密码'});" style="display:none; font-size:12px;" class="navbar-brand userinfonavbar_">
                                欢迎您：{:getAdminName($UserInfo)}
                            </a>
            </div>
            <div class="container-fluid main-nav clearfix">
                <div class="navbar-collapse" style="height:auto;">
                
                <form class="navbar-form navbar-right siteList_mobile" style="display:none;" role="search">
                        <div class="form-group">
                            <select name="siteid" style="max-width:100px;" onChange="window.location.href='?siteid='+this.value" class="form-control">
                                <volist name="site_list" id="vo">
                                    <option value="{$vo.id}" 
                                        <eq name="vo['id']" value="$siteid">selected</eq>>{$vo.title}
                                    </option>
                                </volist>
                            </select>
                        </div>
                    </form>
                
                    <ul class="nav navbar-nav topmenulist">
                        <volist name="left_menu" id="vo">
                            <li class="dropdown hidden">
                                <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                    {$vo.name} <span class="caret"></span>
                                </a>
                                <ul class="dropdown-menu">
                                    <volist name="vo['menu']" id="mvo">
                                    
                                    <if condition="getAccessMenu($accessList, 'Admin', $mvo['name'], 'index')">
                                    
                                        <li>
                                            <a href="{:U($mvo['name'].'/index')}">
                                                {$mvo.title}
                                            </a>
                                        </li>
                                        
                                        </if>
                                        
                                        
                                        
                                    </volist>
                                </ul>
                            </li>
                        </volist>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" style="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                            <span class="option_span" style="display:none;">用户操作 <i class="fa fa-caret-down"></i></span>
                                <i class="glyphicon glyphicon-menu-hamburger option_" style="font-size:1.8em;"></i>
                            </a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="{:U('/',array(),true,false,true,__SITEID__)}" target="_blank" title="前台首页">
                                        前台首页
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:void(0);" class="clearCache">
                                        清除缓存
                                    </a>
                                </li>
                                <li role="separator" class="divider"></li>
                                <li>
                                    <a href="{:U('Admin/Public/logout')}" title="退出登录">
                                        退出登录
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                    <form class="navbar-form navbar-right siteList_" role="search">
                        <div class="form-group">
                            <select name="siteid" style="max-width:100px;" onChange="window.location.href='?siteid='+this.value" class="form-control">
                                <volist name="site_list" id="vo">
                                    <option value="{$vo.id}" 
                                        <eq name="vo['id']" value="$siteid">selected</eq>>{$vo.title}
                                    </option>
                                </volist>
                            </select>
                        </div>
                    </form>
                    <ul class="nav navbar-nav navbar-right userinfo_" style="margin-top:10px;">
                        <li class="dropdown">
                            <a href="##" onClick="art.dialog.open('{:U('Index/info')}', {width: 500, height: 350,lock:true,title:'修改密码'});" style="padding:10px;" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <i class="glyphicon glyphicon-user" style="font-size:1.2em;"></i> 欢迎您：{:getAdminName($UserInfo)}
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
</div>

<!--头部结束-->



<script src="/Public/Js/ElementFlex/jquery.flex.js"></script>


<include file="Collect:header" />
<div class="container main"> <include file="Public:left" />
  <div class="w790"> 
    <script>
  	function uploaded(path){
		$("#img_url").attr("src",'__PUBLIC__'+path);
		$("input[name='img_url']").val(path);
	}
	function del_img(){
		if(confirm('您确定要删除图片吗?')){
			var file=$("input[name='img_url']").val();
			$.post("{:U('delImgBypath')}",{'path':file},function(data){
				$("input[name='img_url']").val('');
				$("#img_url").attr('src','');
			});
		}else{
			return false;
		}
	}
	//切换栏目方式
	function parseCateType(e){
		if($(e).val()==1){
			$('#pagesize').show();
		}else{
			$('#pagesize').hide();
		} 
	}
	function after(e){
	    $(e).parent().parent().parent().parent().parent('li').after($(e).parent().parent().parent().parent().parent('li').prev());
    }
    function append(e){
	    $(e).parent().parent().parent().parent().parent('li').next().after($(e).parent().parent().parent().parent().parent('li'));
    }
	function delnews(e){
		$(e).parent().parent().parent().parent().parent().remove();
	}
	function addnews(){
		var html = $('#copyHTML').html();
		$(html).appendTo('#replyList ul');
	}
	
	
	function getExtends(e){
		var v = $('#extendsList'+$(e).val()).val();
		$('#extends').val(v);
	}
	$('.step .text').eq(2).addClass('on');
	document.title = '插入广告';
  </script>
    <style>
	.header{display:none;}
  	#replyList ul li{margin-top:5px; background:#eee; padding:8px; width:700px;}
	.delnews{display:block; width:30px; font-size:20px; height:30px; border-radius:15px; background:#f00; color:#fff; line-height:30px; text-align:center;}
  </style>
    <div class="h" style="display:none;"><a href="{:U('index')}" class="btn btn-info"><i class="glyphicon glyphicon-circle-arrow-left"></i> 返回采集</a> </div>
    <form class="checkoutform form-horizontal" action="{:U('release')}" method="post">
      <div class="table_ container">
        <input type="hidden" name="id" value="{$info.id}">
        
        
        
        
        
        <div class="form-group">
          
          <div class="col-sm-10">
            <volist name="pagelist" id="vo"> <a class="btn btn-success" href="javascript:void(0);" onClick="showAdvList({$vo.id});">点击选择广告模板</a> </volist>
          </div>
        </div>
        <div class="form-group">
          
          <input type="hidden" id="modules_id" value="{$info.modules_id}" name="modules_id">
          <div class="col-sm-12" id="AdvBox" style="padding:0;"> 请先选择一个广告 </div>
        </div>
    </form>
  </div>
  <div class="clear"></div>
</div>
<script>
//加载广告位，实现编辑
function loadModules(id){
	$.post('<?php echo U('Modules/getOne');?>',
			{id:id}, function(data){
				if(data.data != ''){
					$('#AdvBox').html(data.data);
					bindEditText();
					$(window).resize(function(){
						$('#AdvBox .main-code').Elementflex();
					});
					$('#AdvBox .main-code').Elementflex();
					$('#EditTextBox').mouseleave(function(e) {
            $(this).hide();
        });
				}
			},'json');
    
}

$(document).ready(function(e) {
	loadModules($('#modules_id').val());
});

    function showAdvList(id){
		$('body .container').addClass('hidden');
		$('body .step').addClass('hidden');
		var mydialog1 = mydialog.open('{:U('Home/Modules/AdvList', array('id' => 'pages_id'), true, false, true, __SITEID__)}'.replace('pages_id',id),{init:function(){
			$('.aui_state_focus').addClass('auii_statei_focus');
			//$('.auii_statei_focus .main-code').Elementflex();
			//$(window).trigger('resize');
			
			var niceScroll = $(mydialog1.DOM.outer[0]).find('.aui_main').niceScroll({
                            styler: "fb",
                            cursorcolor: "#65cea7", 
                            cursorwidth: '3',
                            cursorborderradius: '0px', 
                            background: '#424f63',
							scrollspeed:20,
                            spacebarenabled: false,
                            cursorborder: '0'
                        });
			
		},width: '100%', height: $(window).height() - 90,lock:false,title:'请选择一个广告然后点击确定', ok:function(){
			var d = this.iframe.contentWindow.document;
			var modules_id = $(d).find('.on.viewBox').attr('modulesID');
			$('#modules_id').val(modules_id);
			loadModules(modules_id);
		},close: function () {
			$('body .step').removeClass('hidden');
			    $('body .container').removeClass('hidden');
            }});
	}
	
	
	
	
	
	
	
	
	
	function bindEditText(){
		<if condition="!isMobile()">
		$('#EditTextBox').rightClick(function(e){
			$('#EditTextBox').hide();
		});
		$('#EditTextBox_').rightClick(function(e){
			$('#EditTextBox_').hide();
		});</if>
		$('.viewBox').each(function(viewBoxindex, viewBoxelement) {
			
			if($(viewBoxelement).find('.viewBox').length == 0){
			
		// 自定义模块编辑
		$(viewBoxelement).find('.editText').each(function(index, element) {
			$(this).mouseenter(function(e) {
				var height = $(this).outerHeight();
				var width = $(this).outerWidth();
				var top = $(this).offset().top;
				var left = $(this).offset().left;
				$('#EditTextBox').css({'top':top+'px', 'left':left+'px', 'line-height':height+'px'});
				$('#EditTextBox').width(width-2);
				$('#EditTextBox').height(height-2);
				$('#EditTextBox').show();
				//var className = '.'+$(this).attr('class').replaceAll(' ','.');
				$('#EditTextBox').attr('name', $(this).attr('name'));
				$('#EditTextBox').attr('title', $(viewBoxelement).attr('title'));
				$('#EditTextBox').attr('modulesID', $(viewBoxelement).attr('modulesID'));
				$('#EditTextBox').attr('datatype', $(this).attr('datatype'));
				
				$('#EditTextBox').show();
			});
		});
		
		// 布局模块编辑
		$(viewBoxelement).find('.wrap-box').each(function(index, element) {
			$(this).mouseenter(function(e) {
				var height = $(this).outerHeight();
				var width = $(this).outerWidth();
				var top = $(this).offset().top;
				var left = $(this).offset().left;
				$('#EditTextBox_').css({'top':top+'px', 'left':left+'px', 'line-height':height+'px'});
				$('#EditTextBox_').width(width-2);
				$('#EditTextBox_').height(height-2);
				$('#EditTextBox_').show();
				$('#EditTextBox_').attr('index', index);
				//数据类型
				if($(this).find('img').length == 1){
					$('#EditTextBox_').attr('datatype', 'image');
				}else{
					$('#EditTextBox_').attr('datatype', 'text');
				}
				$('#EditTextBox_').attr('title', $(viewBoxelement).attr('title'));
				$('#EditTextBox_').attr('modulesID', $(viewBoxelement).attr('modulesID'));
			});
		});
		
		
		
		
			}
		
	});
	}
	
	//编辑单个自定义字段
	function showEditTextBox(){
        $('#EditTextBox').hide();
		$('.viewBox *').unbind('mouseenter');
		var width = $(window).width();
		if(width > 400){
		    width = 400;
		}
		$('body .container:eq(0)').hide();
		var mydialog1 = mydialog.load('<?php echo U('Admin/Modules/editText');?>'.replace('/<?php echo __SITEID__;?>/','/')+'?datatype='+$('#EditTextBox').attr('datatype')+'&name='+$('#EditTextBox').attr('name')+'&modules_id='+$('#EditTextBox').attr('modulesID'), {init:function(){
			$('.aui_state_focus').addClass('auii_statei_focus');
			$('body .step').addClass('hidden');
			    $('body .container').addClass('hidden');
			
			
		},width: width+'px', height: $(window).height()-90,title:$('#EditTextBox').attr('title')+'-编辑',lock: false,ok:function(){
			//var d = this.iframe.contentWindow.document;
			var d = mydialog1.DOM.outer[0];
			var textValue = $(d).find('#textValue').val();
			$.post(
			'<?php echo U('Admin/Modules/saveText');?>'.replace('/<?php echo __SITEID__;?>/','/'),
			{'name':$(d).find('#name').val(),'value':$(d).find('#value').val(), 'id':$(d).find('#id').val(), 'link':$(d).find('#link').val()},
			function(data){
				loadModules($('#EditTextBox').attr('modulesID'));
				
			},'json');
		},close: function () {
			$('.ueditorelement').each(function(index, element) {
                UE.getEditor($(this).attr('id')).destroy(); 
            });
			$('body .step').removeClass('hidden');
			    $('body .container').removeClass('hidden');
                bindEditText();
            }});
	}
	
	
	//编辑单个布局模块元素
	function showEditTextBox_(){
        $('#EditTextBox_').hide();
		$('.viewBox *').unbind('mouseenter');
		var width = $(window).width();
		if(width > 400){
		    width = 400;
		}
		$('body .step').addClass('hidden');
		$('body .container').addClass('hidden');
		var mydialog1 = mydialog.load('<?php echo U('Admin/Modules/editModelText');?>'.replace('/<?php echo __SITEID__;?>/','/')+'?index='+$('#EditTextBox_').attr('index')+'&datatype='+$('#EditTextBox_').attr('datatype')+'&modules_id='+$('#EditTextBox_').attr('modulesID'), {init:function(){
			$('.aui_state_focus').addClass('auii_statei_focus');
			
			
			
		},width: width+'px', height: $(window).height()-90,title:$('#EditTextBox_').attr('title')+'-编辑',lock: false,ok:function(){
			//var d = this.iframe.contentWindow.document;
			var d = mydialog1.DOM.outer[0];
			
			$(d).find('#editcode .wrap-box').eq($('#EditTextBox_').attr('index')).find('a').attr('href',$(d).find('#link').val());
			$(d).find('#editcode .wrap-box').eq($('#EditTextBox_').attr('index')).find('img').attr('src',$(d).find('#img_url').attr('src'));
			if($('#EditTextBox_').attr('datatype') == 'text'){
				getContent();
			}
			var textValue = $(d).find('#editcode').html();
			$.post(
			'<?php echo U('Admin/Modules/saveModelText');?>'.replace('/<?php echo __SITEID__;?>/','/'),
			{'value':$(d).find('#editcode').html(), 'id':$(d).find('#id').val()},
			function(data){
				loadModules($('#EditTextBox_').attr('modulesID'));
				
			},'json');
		},close: function () {
			$('.ueditorelement').each(function(index, element) {
                UE.getEditor($(this).attr('id')).destroy(); 
            });
			   $('body .step').removeClass('hidden');
			    $('body .container').removeClass('hidden');
                bindEditText();
            }});
	}
	
	
	
	
	

		
</script>
<style>
    #AdvBox{border:1px dashed #CF9394;}
	.nextbtn a{display:block; margin:0 10px;}
	
	.auii_statei_focus{top:0 !important; left:0 !important; right:0 !important; bottom:0 !important; width:auto !important; position:static !important;}
	
	.auii_statei_focus .aui_c,.auii_statei_focus .aui_border > tbody > tr, .auii_statei_focus .aui_border,.auii_statei_focus .aui_border > tbody{display:block;}
	.auii_statei_focus .aui_main{width:100% !important; display:table-cell;}
	.aui_main{ display:table-cell;}
	.auii_statei_focus .aui_content{padding:0 !important;}
</style>
<div class="row nextbtn" style="position:fixed; bottom:0; background:rgba(0,0,0,0.62); width:100%; padding:8px 0; margin:0;">
<div class="col-xs-6">
        <a href="javascript:history.go(-1);" class="btn btn-default">上一步</a>
    </div>
    <div class="col-xs-6">
        <a href="javascript:void(0);" onClick="$('.checkoutform').submit();" class="btn btn-success">确认发布</a>
    </div>
    
</div>
<!-- 查找元素时用的高亮层 -->
<div id="EditTextBox" datatype="" name="" modulesID="" onclick="showEditTextBox();" style="position: absolute; display:none; z-index: 8000000; background-color: rgba(0, 0, 0, 0.6); border:1px dashed #ccc; color:#fff; text-align:center; line-height:1;">点击修改</div>
<!-- 查找元素时用的高亮层end -->

<!-- 查找元素时用的高亮层 -->
 <div id="EditTextBox_" index="" datatype="" modulesID="" onclick="showEditTextBox_();" style="position: absolute; display:none; z-index: 8000000; background-color: rgba(0, 0, 0, 0.6); border:1px dashed #ccc; color:#fff; text-align:center; line-height:1;">点击修改</div>
<!-- 查找元素时用的高亮层end -->
</body></html>